<?php
/**
 * Created by PhpStorm.
 * User: dust2
 * Date: 14-11-21
 * Time: 下午4:21
 */

class ProductTableSeeder extends Seeder
{
    public function run()
    {
        DB::table('products')->delete();

        //for recommend products
        for ($i = 1; $i <=7; $i++) {
            Product::insert([
                'name' => '商品'.$i,
                'price' => $i * 2,
                'class_id' => 1,
                'amount' => 10,
                'image' => '/image/product.png',
                'description' => 'description about product '.$i,
                'created_at' => time(),
                'updated_at' => time()
            ]);
        }


        //for classfication products
        for ($i = 8; $i <= 32; $i++) {
            Product::insert([
                'name' => '商品'.$i,
                'price' => $i * 2,
                'class_id' => $i % 2 + 2,
                'amount' => 10,
                'image' => '/image/product.png',
                'description' => 'description about product '.$i,
                'created_at' => time(),
                'updated_at' => time()
            ]);
        }


    }

} 